<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>ins</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="inrg.html" title="inrg" />
    <link rel="next" href="insremot.html" title="insremot" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">ins</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="inrg.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="insremot.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="ins"></a>
      <div class="titlepage"></div>
      <a id="Indexins" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">ins</span>
        </h2>
        <p>ins — 
      Reads stereo audio data from an external device or stream.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp116691248"></a>
        <h2>Description</h2>
        <p>
      Reads stereo audio data from an external device or stream.
    </p>
        <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning: Warning">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">Warning</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        This opcode is designed to be used only with orchestras that have
        nchnls_i=2. Doing so with orchestras with nchnls_i &gt; 2 will
        cause incorrect audio input.
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idp116751200"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ar1, ar2 <span class="command"><strong>ins</strong></span></pre>
      </div>
      <div class="refsect1">
        <a id="idp116753088"></a>
        <h2>Performance</h2>
        <p>
      Reads stereo audio data from an external device or stream. If the command-line <a class="link" href="CommandFlags.html#FlagsMinusLowerI"><em class="citetitle">-i</em></a> flag is set, sound is read continuously from the audio input stream (e.g. <span class="emphasis"><em>stdin</em></span> or a soundfile) into an internal buffer. Any number of these opcodes can read freely from this buffer.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp116755776"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the ins opcode. It uses the file <a class="ulink" href="examples/ins.csd" target="_top"><em class="citetitle">ins.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp116757632"></a>
          <p class="title">
            <strong>Example 399. Example of the ins opcode.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac   -idac   <span class="comment">;;;realtime audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; ins.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2				<span class="comment">;two channels out</span>
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1 

ain1, ainr <span class="opc">ins</span>				<span class="comment">;grab your mic and sing</span>
adel  <span class="opc">linseg</span> 0, p3<span class="op">*</span>.5, 0.02, p3<span class="op">*</span>.5, 0	<span class="comment">;max delay time = 20ms</span>
aoutl <span class="opc">flanger</span> ain1, adel, .7
aoutr <span class="opc">flanger</span> ain1, adel<span class="op">*</span>2, .8
      <span class="opc">fout</span> "in_s.wav", 14, aoutl, aoutr <span class="comment">;write to stereo file,</span>
      <span class="opc">outs</span> aoutl, aoutr			<span class="comment">;16 bits with header</span>

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 10
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />      
    </p>
      </div>
      <div class="refsect1">
        <a id="idp116759552"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="diskin.html" title="diskin"><em class="citetitle">diskin</em></a>,
      <a class="link" href="in.html" title="in"><em class="citetitle">in</em></a>,
      <a class="link" href="inch.html" title="inch"><em class="citetitle">inh</em></a>,
      <a class="link" href="inh.html" title="inh"><em class="citetitle">inh</em></a>,
      <a class="link" href="ino.html" title="ino"><em class="citetitle">ino</em></a>,
      <a class="link" href="inq.html" title="inq"><em class="citetitle">inq</em></a>,
      <a class="link" href="soundin.html" title="soundin"><em class="citetitle">soundin</em></a>
      <a class="link" href="mp3in.html" title="mp3in"><em class="citetitle">mp3in</em></a>,
     </p>
      </div>
      <div class="refsect1">
        <a id="idp116768032"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Authors: Barry L. Vercoe, Matt Ingalls/Mike Berry</td>
          </tr>
          <tr>
            <td>MIT, Mills College</td>
          </tr>
          <tr>
            <td>1993-1997</td>
          </tr>
        </table>
        <p>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="inrg.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="insremot.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">inrg </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> insremot</td>
        </tr>
      </table>
    </div>
  </body>
</html>
